package cn.iocoder.yudao.module.system.controller.app.info;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.info.vo.SystemInfoRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.info.SystemInfoDO;
import cn.iocoder.yudao.module.system.service.info.SystemInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 系统信息")
@RestController
@RequestMapping("/system/info")
@Validated
public class AppSystemInfoController {

    @Resource
    private SystemInfoService infoService;

    @GetMapping("/get")
    @Operation(summary = "获得系统信息")
    @PermitAll
    public CommonResult<SystemInfoRespVO> getInfo() {
        SystemInfoDO info = infoService.getInfo();
        return success(BeanUtils.toBean(info, SystemInfoRespVO.class));
    }

}